<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>快速修复测试</title>
    <style>
        body { font-family: Arial, sans-serif; margin: 20px; }
        .test-result { margin: 10px 0; padding: 10px; border-radius: 5px; }
        .success { background-color: #d4edda; color: #155724; }
        .error { background-color: #f8d7da; color: #721c24; }
        .warning { background-color: #fff3cd; color: #856404; }
        pre { background: #f8f9fa; padding: 10px; border-radius: 5px; overflow-x: auto; }
    </style>
</head>
<body>
    <h1>🚀 快速修复测试</h1>
    <p>测试最新修复：科学计数法 + 负数解析</p>
    
    <div id="test-results"></div>
    
    <script src="dbc-parser.js"></script>
    <script>
        const testFiles = [
            'cadillac_ct6_object.dbc',    // 科学计数法测试
            'ford_cgea1_2_ptcan_2011.dbc', // 负数测试  
            'tesla_model3_party.dbc',     // 负数范围测试
            'mazda_2017.dbc'              // VAL_定义测试
        ];
        
        async function runQuickTest() {
            const results = document.getElementById('test-results');
            
            for (const filename of testFiles) {
                const resultDiv = document.createElement('div');
                resultDiv.className = 'test-result';
                
                try {
                    console.log(`测试文件: ${filename}`);
                    const response = await fetch(filename);
                    const content = await response.text();
                    
                    const startTime = performance.now();
                    const result = parseDBCContent(content, filename);
                    const endTime = performance.now();
                    const duration = Math.round(endTime - startTime);
                    
                    resultDiv.className += ' success';
                    resultDiv.innerHTML = `
                        <strong>✅ ${filename}</strong><br>
                        ${duration}ms | ${result.frames.length}帧 | 
                        ${result.frames.reduce((sum, f) => sum + f.signals.length, 0)}信号 | 
                        ${result.warnings.length}警告
                    `;
                    
                    console.log(`✅ ${filename}: ${result.frames.length}帧, ${result.warnings.length}警告`);
                    if (result.warnings.length > 0) {
                        console.log('警告:', result.warnings.slice(0, 3));
                    }
                    
                } catch (error) {
                    resultDiv.className += ' error';
                    resultDiv.innerHTML = `
                        <strong>❌ ${filename}</strong><br>
                        错误: ${error.message}
                    `;
                    console.error(`❌ ${filename}:`, error.message);
                }
                
                results.appendChild(resultDiv);
            }
        }
        
        runQuickTest();
    </script>
</body>
</html> 